package com.air.config.startegy.common;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 策略上下文
 * 可用工厂模式代替
 *
 * @author shent
 */
@Configuration
public class StrategyContext {
    @Resource
    public Map<String, Strategy> strategyMap;

    public List<Object> doGet(String type) {
        Strategy strategy = strategyMap.get(type);
        return strategy.doStrategy();
    }
}
